package com.dao.cook.imp;

import java.util.List;

import javax.annotation.Resource;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.stereotype.Repository;

import com.dao.cook.CdishDaoY;
import com.po.Dish;

@Repository
public class CdishDaoImpY implements CdishDaoY {
	
	@Resource(name = "sqlSessionTemplate")
	private SqlSessionTemplate sqlSessionTemplate;

	@Override
	public Dish findDishOne(String dish_id) {
		Dish dish=sqlSessionTemplate.selectOne("findDishOneY",dish_id);
		return dish;
	}
	@Override
	public List<Dish> findDishByName(String dish_name) {
		List<Dish> dish=sqlSessionTemplate.selectList("findDishByNameY", dish_name);
		return dish;
	}
	
	@Override
	public List<Dish> getDishList() {
		List<Dish> dishlist=sqlSessionTemplate.selectList("getDishListY");
		return dishlist;
	}

	@Override
	public int addDish(Dish dish) {
		int i=sqlSessionTemplate.insert("addDishY", dish);
		return i;
	}

	@Override
	public int delDish(String dish_id) {
		int i=sqlSessionTemplate.delete("delDishY", dish_id);
		return i;
	}

	@Override
	public int updateDish(Dish dish) {
		int i=sqlSessionTemplate.update("updateDishY", dish);
		return i;
	}

	
}
